package com.wz.project.stock.record.service.impl;

import com.wz.common.utils.text.Convert;
import com.wz.project.stock.domain.BasStockMaintainRecord;
import com.wz.project.stock.record.mapper.BasStockMaintainRecordMapper;
import com.wz.project.stock.record.service.IBasStockMaintainRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

/**
 * 库存维护记录Service业务层处理
 * 
 * @author wz
 * @date 2022-04-19
 */
@Service
public class BasStockMaintainRecordServiceImpl implements IBasStockMaintainRecordService
{
    @Autowired
    private BasStockMaintainRecordMapper basStockMaintainRecordMapper;

    /**
     * 查询库存维护记录
     * 
     * @param whGuid 库存维护记录ID
     * @return 库存维护记录
     */
    @Override
    public BasStockMaintainRecord selectBasStockMaintainRecordById(String whGuid)
    {
        return basStockMaintainRecordMapper.selectBasStockMaintainRecordById(whGuid);
    }

    /**
     * 查询库存维护记录列表
     * 
     * @param basStockMaintainRecord 库存维护记录
     * @return 库存维护记录
     */
    @Override
    public List<BasStockMaintainRecord> selectBasStockMaintainRecordList(BasStockMaintainRecord basStockMaintainRecord)
    {
        return basStockMaintainRecordMapper.selectBasStockMaintainRecordList(basStockMaintainRecord);
    }

    /**
     * 新增库存维护记录
     * 
     * @param basStockMaintainRecord 库存维护记录
     * @return 结果
     */
    @Override
    public int insertBasStockMaintainRecord(BasStockMaintainRecord basStockMaintainRecord)
    {
        basStockMaintainRecord.setCreateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
        return basStockMaintainRecordMapper.insertBasStockMaintainRecord(basStockMaintainRecord);
    }

    /**
     * 修改库存维护记录
     * 
     * @param basStockMaintainRecord 库存维护记录
     * @return 结果
     */
    @Override
    public int updateBasStockMaintainRecord(BasStockMaintainRecord basStockMaintainRecord)
    {
        return basStockMaintainRecordMapper.updateBasStockMaintainRecord(basStockMaintainRecord);
    }

    /**
     * 删除库存维护记录对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteBasStockMaintainRecordByIds(String ids)
    {
        return basStockMaintainRecordMapper.deleteBasStockMaintainRecordByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除库存维护记录信息
     * 
     * @param whGuid 库存维护记录ID
     * @return 结果
     */
    @Override
    public int deleteBasStockMaintainRecordById(String whGuid)
    {
        return basStockMaintainRecordMapper.deleteBasStockMaintainRecordById(whGuid);
    }
}
